Passed
Pull Request — master (#38)
by lv
04:13
created

module.exports.first   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
dl 11
loc 11
rs 10
nop 1
1 View Code Duplication
const DB = require('../../libraries/db')
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
const ModelBase = require('../../model/base')
3
4
const table = 'mist_store'
5
6
module.exports = {
7
    add: async function (data) {
8
        let res = await ModelBase.execInsert(table, data)
9
        return res;
10
    },
11
12
	first: async function (id) {
13
14
		let result = DB.readMysql.first(
15
			'*'
16
		)
17
			.from(table)
18
			.where('id', id)
19
20
		return await result
21
22
	},
23
24
	getSellerStores: async function (sellerId) {
25
26
		let result = DB.readMysql.select(
27
			'*'
28
		)
29
			.from(table)
30
			.where('seller_id', sellerId)
31
32
		return await result
33
34
	},
35
36
	edit: async function (data, where, notWhere = {}) {
37
		let result = ModelBase.execUpdate(table, data, where, notWhere)
38
39
		return await result
40
	}
41
42
}